home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Found / FWDebug / Sources / FWGlue.asm < prev    next >
Encoding:
Assembly Source File  |  1995-11-08  |  2.4 KB  |  128 lines  |  [TEXT/MPS ]

  1. ;========================================================================================
  2. ;
  3. ;    File:                FWGlue.asm
  4. ;    Release Version:    $ 1.0d11 $
  5. ;
  6. ;    Creation Date:        3/28/94
  7. ;
  8. ;    Copyright:    (c) 1993, 1995 by Apple Computer, Inc., all rights reserved.
  9. ;
  10. ;========================================================================================
  11.  
  12.     LOCALS            ; Yes, we want local symbols on (those prefixed with a @@)
  13.     Model    Large    ; Large memory model
  14.     .286            ; Enable i286 instructions for things like "PUSHALL"
  15.     
  16.     %NOINCL
  17.     include    macros.asm
  18.     
  19.     c_name    _trace_pro_f
  20.     c_name    _trace_epi_f
  21.  
  22.     public _trace_pro_f
  23.     public _trace_epi_f
  24.         
  25.         extrn ?TraceIn@_FW_CTraceRuntime@@TAXXZ:far        ; _FW_CTraceRuntime::TraceIn()
  26.         extrn ?TraceOut@_FW_CTraceRuntime@@TAXXZ:far    ; _FW_CTraceRuntime::TraceOut()
  27.  
  28.         begdata
  29.         
  30. ;========================================================================================
  31. ; We might call a tracer that's itself compiled with tracing on.  To prevent
  32. ; infinite loops, stack faults, nuclear disasters, etc., we have this little
  33. ; varibale here that we use as a semaphore
  34. ;========================================================================================
  35.         
  36. nTraceNesting dw 0
  37.         
  38.         enddata
  39.  
  40.         begcode    Trace
  41.         
  42. PushAll macro
  43.         pusha
  44.         pushf
  45.         push ES
  46.         push DS
  47. endm
  48.  
  49. PopAll macro
  50.         pop DS
  51.         pop ES
  52.         popf
  53.         popa
  54. endm
  55.         
  56. ;========================================================================================
  57. ; _trace_pro_f
  58. ;
  59. ;    Called by SymC++ when a function is entered.
  60. ;========================================================================================
  61.  
  62. func _trace_pro_f
  63.  
  64.         WINENTER
  65.  
  66.         PushAll
  67.         
  68.         mov    AX, DGROUP
  69.         mov DS, AX
  70.         
  71.         inc nTraceNesting
  72.         
  73.         cmp nTraceNesting, 1
  74.         jne _pro_exit
  75.         
  76.         call ?TraceIn@_FW_CTraceRuntime@@TAXXZ
  77.  
  78.         mov    AX, DGROUP
  79.         mov DS, AX
  80.  
  81. _pro_exit:
  82.         dec    nTraceNesting
  83.         
  84.         PopAll
  85.  
  86.         WINLEAVE
  87.         retf
  88.         
  89. c_endp _trace_pro_f
  90.  
  91. ;========================================================================================
  92. ; @_trace_epi_f()
  93. ;
  94. ;    Called by SymC++ when a function is exited.
  95. ;========================================================================================
  96.  
  97. func _trace_epi_f
  98.  
  99.         WINENTER
  100.  
  101.         PushAll
  102.  
  103.         mov    AX, DGROUP
  104.         mov DS, AX
  105.         
  106.         inc nTraceNesting
  107.         
  108.         cmp nTraceNesting, 1
  109.         jne _epi_exit
  110.     
  111.         call ?TraceOut@_FW_CTraceRuntime@@TAXXZ
  112.  
  113.         mov    AX, DGROUP
  114.         mov DS, AX
  115.  
  116. _epi_exit:
  117.         dec    nTraceNesting
  118.         
  119.         PopAll
  120.         
  121.         WINLEAVE
  122.         retf
  123.         
  124. c_endp _trace_epi_f
  125.  
  126.         endcode    Trace
  127.         end
  128.